home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _IEHeadInsertEventScript.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  35 lines

  1. ; *******************************************************
  2. ; Example 1 - Open a browser with the basic example page, insert an
  3. ;                event script into the head of the document that creates
  4. ;                a JavaScript alert when someone clicks on the document
  5. ; *******************************************************
  6. ;
  7. #include <IE.au3>
  8. $oIE = _IE_Example ("basic")
  9. _IEHeadInsertEventScript ($oIE, "document", "onclick", "alert('Someone clicked the document!');")
  10.  
  11. ; *******************************************************
  12. ; Example 2 - Open a browser with the basic example page, insert an
  13. ;                event script into the head of the document that creates
  14. ;                a JavaScript alert when someone tries to right-click on the
  15. ;                document and then the event script returns "false" to prevent
  16. ;                the right-click context menu from appearing
  17. ; *******************************************************
  18. ;
  19. #include <IE.au3>
  20. $oIE = _IE_Example ("basic")
  21. _IEHeadInsertEventScript ($oIE, "document", "oncontextmenu", "alert('No Context Menu');return false")
  22.  
  23. ; *******************************************************
  24. ; Example 3 - Open a browser with the basic example page, insert an
  25. ;                event script into the head of the document that creates a
  26. ;                JavaScript alert when we are about to navigate away from the 
  27. ;                page and presents the option to cancel the operation.
  28. ; *******************************************************
  29. ;
  30. #include <IE.au3>
  31. $oIE = _IE_Example ("basic")
  32. _IEHeadInsertEventScript ($oIE, "window", "onbeforeunload", _
  33.     "alert('Example warning follows...');return 'Pending changes may be lost';")
  34. _IENavigate($oIE, "www.autoitscript.com")
  35.